﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EventManagement.aspx.cs" Inherits="MedicareWebUI.EventManagement" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        Search By:
        <asp:DropDownList ID="DropDownList1" runat="server" 
            onselectedindexchanged="DropDownList1_SelectedIndexChanged" 
            AutoPostBack="True">
            <asp:ListItem Value="Last Name">Last Name</asp:ListItem>
            <asp:ListItem>Social Security Number</asp:ListItem>
            <asp:ListItem>Date of Birth</asp:ListItem>
        </asp:DropDownList>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:TextBox ID="txtSearchDate" runat="server" TextMode="Date"></asp:TextBox>
        <asp:Button ID="btnSearch" runat="server" onclick="btnSearch_Click" 
            Text="Search" />
        <asp:Button ID="btnReset" runat="server" onclick="btnReset_Click" 
            Text="Reset" />
        <br />
        <br />
    
        Pending Requests:<asp:GridView 
            ID="gridResults" runat="server" AutoGenerateColumns="False" 
            CellPadding="4" DataSourceID="searchDataSource" ForeColor="#333333" 
            GridLines="None" ShowHeaderWhenEmpty="True" DataKeyNames="idPatient"
                onselectedindexchanged="gridResults_SelectedIndexChanged" 
            AllowPaging="True">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:CommandField ShowSelectButton="True" />
                <asp:BoundField DataField="idPatient" HeaderText="Patient ID" 
                    SortExpression="idPatient" />
                <asp:BoundField DataField="name" HeaderText="Name" SortExpression="name" />
                <asp:BoundField DataField="lastName" HeaderText="Last Name" 
                    SortExpression="lastName" />
                <asp:BoundField DataField="ssn" HeaderText="Social Security Number" SortExpression="ssn" />
                <asp:BoundField DataField="dob" HeaderText="Date of Birth" SortExpression="dob" />
                <asp:BoundField DataField="address" HeaderText="Address" 
                    SortExpression="address" />
                <asp:BoundField DataField="phone" HeaderText="Phone" SortExpression="phone" />
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
        </asp:GridView>
        <asp:ObjectDataSource ID="searchDataSource" runat="server" 
            SelectMethod="searchPatients" TypeName="MedicareBusiness.PatientBO" 
                DeleteMethod="deletePatient">
            <DeleteParameters>
                <asp:Parameter Name="aPatientID" Type="Int32" />
            </DeleteParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="DropDownList1" DefaultValue="0" 
                    Name="anOperator" PropertyName="SelectedIndex" Type="Int32" />
                <asp:ControlParameter ControlID="TextBox1" 
                    Name="aCriteria" PropertyName="Text" Type="String" />
            </SelectParameters>
        </asp:ObjectDataSource>
        <br />
    
        <asp:GridView ID="gridPatients" runat="server" AutoGenerateColumns="False" 
            DataSourceID="PatientDataSource" DataKeyNames="idPatient"
            onselectedindexchanged="GridView1_SelectedIndexChanged" CellPadding="4" 
            ForeColor="#333333" GridLines="None" ShowHeaderWhenEmpty=True 
            AllowPaging="True">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:CommandField ShowSelectButton="True" />
                <asp:BoundField DataField="idPatient" HeaderText="Patient ID" 
                    SortExpression="idPatient" />
                <asp:BoundField DataField="name" HeaderText="Name" SortExpression="name" />
                <asp:BoundField DataField="lastName" HeaderText="Last Name" 
                    SortExpression="lastName" />
                <asp:BoundField DataField="ssn" HeaderText="Social Security Number" SortExpression="ssn" />
                <asp:BoundField DataField="dob" HeaderText="date of Birth" SortExpression="dob" />
                <asp:BoundField DataField="address" HeaderText="Address" 
                    SortExpression="address" />
                <asp:BoundField DataField="phone" HeaderText="Phone #" SortExpression="phone" />
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
        </asp:GridView>
        <asp:ObjectDataSource ID="PatientDataSource" runat="server" 
            SelectMethod="getPendingPatients" TypeName="MedicareDataAccess.PatientDAO">
        </asp:ObjectDataSource>
    
    </div>
    <br />
    <br />
    Review patient info: 
        <br />
        <br />
       Patient ID:&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:TextBox ID="txtID" runat="server" Enabled="False"></asp:TextBox>
        <br />
        Name:&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
        &nbsp;&nbsp;&nbsp;
        <br />
        Last Name: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:TextBox ID="txtLastName" runat="server"></asp:TextBox>
        &nbsp;&nbsp;&nbsp;
        <br />
        DNI/SSN:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
         <asp:TextBox ID="txtSSN" runat="server"></asp:TextBox>
        &nbsp;&nbsp;&nbsp;
        <br />
       Date of Birth:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        <asp:TextBox ID="txtDOB" runat="server"></asp:TextBox>
        &nbsp;&nbsp;&nbsp;
        &nbsp;<br />
        Address: &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        <asp:TextBox ID="txtAddress" runat="server"></asp:TextBox>
        &nbsp;
    <asp:RequiredFieldValidator ID="ValAddress" runat="server" 
        ControlToValidate="txtAddress" Display="Dynamic" 
        ErrorMessage="Field Cannot be Empty"></asp:RequiredFieldValidator>
        <br />
        Phone:&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        <asp:TextBox ID="txtPhone" runat="server"></asp:TextBox>
        &nbsp;
    <asp:RequiredFieldValidator ID="ValPhone" runat="server" 
        ControlToValidate="txtPhone" Display="Dynamic" 
        ErrorMessage="Field Cannot be Empty"></asp:RequiredFieldValidator>
        <br />
        <br />
        <asp:Button ID="btnUpdate" runat="server" onclick="btnUpdate_Click" 
            Text="Update" />
    <asp:Button ID="btnEvent" runat="server" onclick="btnEvent_Click" 
        Text="Create Event" />
    <br />
    <br />
    <br />
    <br />
    Triage Rank:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:DropDownList ID="dropTriage" runat="server" 
        DataSourceID="TriageDataSource" DataTextField="colorCode" 
        DataValueField="idTriage">
    </asp:DropDownList>
    <asp:ObjectDataSource ID="TriageDataSource" runat="server" 
        SelectMethod="getAllTriage" TypeName="MedicareDataAccess.TriageDAO">
    </asp:ObjectDataSource>
    <br />
    <br />
    Comments:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="txtComments" runat="server" Width="418px"></asp:TextBox>
    &nbsp;&nbsp;
    <asp:RequiredFieldValidator ID="ValComments" runat="server" 
        ControlToValidate="txtComments" Display="Dynamic" 
        ErrorMessage="Field Cannot be Empty"></asp:RequiredFieldValidator>
    <br />
    <br />
    <br />
    <asp:Button ID="btnProcess" runat="server" onclick="btnEMT_Click" 
        Text="Process Request" />
        <br />
    <p>
        &nbsp;</p>
    <p>
        Processed events: 
    </p>
    <p>
        <asp:GridView ID="gridPatients2" runat="server" AutoGenerateColumns="False" 
            DataSourceID="PatientDataSource2" CellPadding="4" ForeColor="#333333" ShowHeaderWhenEmpty="True"
            GridLines="None" AllowPaging="True">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:BoundField DataField="idPatient" HeaderText="Patient ID" 
                    SortExpression="idPatient" />
                <asp:BoundField DataField="name" HeaderText="Name" SortExpression="name" />
                <asp:BoundField DataField="lastName" HeaderText="Last Name" 
                    SortExpression="lastName" />
                <asp:BoundField DataField="ssn" HeaderText="Social Security Number" SortExpression="ssn" />
                <asp:BoundField DataField="dob" HeaderText="Date of Birth" SortExpression="dob" />
                <asp:BoundField DataField="address" HeaderText="Address" 
                    SortExpression="address" />
                <asp:BoundField DataField="phone" HeaderText="Phone" SortExpression="phone" />
                <asp:CheckBoxField DataField="emtTeamSent" HeaderText="emtTeamSent" 
                    SortExpression="emtTeamSent" />
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
        </asp:GridView>
        <asp:ObjectDataSource ID="PatientDataSource2" runat="server" 
            SelectMethod="getTreatedPatients" TypeName="MedicareDataAccess.PatientDAO">
        </asp:ObjectDataSource>
    </p>
    <p>
        &nbsp;</p>
    <p>
        Events with EMT teams assigned:
    </p>
    <p>
        <asp:GridView ID="gridEvents" runat="server" AutoGenerateColumns="False" 
            CellPadding="4" DataSourceID="EventInfoDataSource" ForeColor="#333333" 
            GridLines="None" DataKeyNames="idEvent" ShowHeaderWhenEmpty="True"
            onselectedindexchanged="gridEvents_SelectedIndexChanged" 
            AllowPaging="True">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:CommandField ShowSelectButton="True" />
                <asp:BoundField DataField="idEvent" HeaderText="Event ID" 
                    SortExpression="idEvent" />
                <asp:BoundField DataField="patient" HeaderText="Patient Name" 
                    SortExpression="patient" />
                <asp:BoundField DataField="colorCode" HeaderText="Color Code" 
                    SortExpression="colorCode" />
                <asp:BoundField DataField="status" HeaderText="Status" 
                    SortExpression="status" />
                <asp:BoundField DataField="comments" HeaderText="Comments" 
                    SortExpression="comments" />
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
        </asp:GridView>
        <asp:ObjectDataSource ID="EventInfoDataSource" runat="server" 
            SelectMethod="getProcessedEventsInfo" TypeName="MedicareDataAccess.EventDAO">
        </asp:ObjectDataSource>
    </p>
    <p>
&nbsp;<asp:Button ID="btnEnd" runat="server" onclick="btnEnd_Click" 
            Text="Mark Event as Finished" />
        &nbsp;&nbsp;
        <asp:Label ID="lblSelectedEvent" runat="server"></asp:Label>
    </p>
    <p>
        Finished events: </p>
    <p>
        <asp:GridView ID="gridFinishedEvents" runat="server" 
            AutoGenerateColumns="False" CellPadding="4" DataSourceID="EventInfoDataSource2" 
            ForeColor="#333333" GridLines="None" ShowHeaderWhenEmpty="True"
            onselectedindexchanged="gridFinishedEvents_SelectedIndexChanged" 
            AllowPaging="True">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:BoundField DataField="idEvent" HeaderText="Event ID" 
                    SortExpression="idEvent" />
                <asp:BoundField DataField="patient" HeaderText="Patient Name" 
                    SortExpression="patient" />
                <asp:BoundField DataField="colorCode" HeaderText="Color Code" 
                    SortExpression="colorCode" />
                <asp:BoundField DataField="status" HeaderText="Status" 
                    SortExpression="status" />
                <asp:BoundField DataField="comments" HeaderText="Comments" 
                    SortExpression="comments" />
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
        </asp:GridView>
        <asp:ObjectDataSource ID="EventInfoDataSource2" runat="server" 
            SelectMethod="getFinishedEventsInfo" TypeName="MedicareDataAccess.EventDAO">
        </asp:ObjectDataSource>
    </p>
    <p>
        &nbsp;</p>
    <p>
        &nbsp;</p>
    <asp:Button ID="btnPatient" runat="server" onclick="btnPatient_Click" 
        Text="Patient Management" />
    <asp:Button ID="btnEMT" runat="server" onclick="btnEMT_Click1" 
        Text="EMT Management" />
    </form>
    </body>
</html>
